﻿using AutoMapper;
using MediatR;
using S.Archives.Api.Application.Command.Wander;
using S.Archives.Infrstructre.InterFace;

namespace S.Archives.Api.Application.CommandHandlers.Wander
{
    public class WanderCreatePLCommandHandler : IRequestHandler<WanderCreatePLCommand, bool>
    {
        private readonly IWanderRepository wanderRepository;
        private readonly IMapper mapper;
        public WanderCreatePLCommandHandler(IWanderRepository wanderRepository, IMapper mapper)
        {
            this.mapper = mapper;
            this.wanderRepository= wanderRepository;
        }
        public async Task<bool> Handle(WanderCreatePLCommand request, CancellationToken cancellationToken)
        {
            return await wanderRepository.AddRangeAsync(request.WanderModel);
        }
    }
}
